.keyboard-controls {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  width: 280px;
  max-height: 80vh;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 16px;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  overflow-y: auto;
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.keyboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.keyboard-header:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px;
  margin: -10px -10px 16px -10px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.collapse-arrow {
  color: #00bfff;
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

.collapse-arrow.collapsed {
  transform: rotate(-90deg);
}

.keyboard-content {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 1000px;
    transform: translateY(0);
  }
}

.keyboard-header h3 {
  margin: 0;
  color: #00ff00;
  font-size: 13px;
}

.control-status {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 9px;
  font-weight: bold;
}

.control-status.enabled {
  background: #4CAF50;
  color: white;
}

.control-status.disabled {
  background: #f44336;
  color: white;
}

.control-section {
  margin-bottom: 16px;
}

.control-section h4 {
  margin: 0 0 8px 0;
  color: #00bfff;
  font-size: 11px;
  border-left: 2px solid #00bfff;
  padding-left: 6px;
}

.key-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.key-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.key-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  min-height: 40px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  cursor: default;
  transition: all 0.2s ease;
  user-select: none;
}

.key-button.active {
  background: rgba(0, 255, 0, 0.3);
  border-color: #00ff00;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  transform: scale(1.05);
}

.key-button.disabled {
  opacity: 0.4;
  background: rgba(128, 128, 128, 0.2);
}

.key-button.action-key {
  background: rgba(0, 123, 255, 0.2);
  border-color: rgba(0, 123, 255, 0.5);
}

.key-button.action-key.active {
  background: rgba(0, 123, 255, 0.4);
  border-color: #007bff;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.6);
}

.key-button.emergency-key {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.5);
}

.key-button.emergency-key.active {
  background: rgba(255, 0, 0, 0.4);
  border-color: #ff0000;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
}

.key-label {
  font-size: 10px;
  font-weight: bold;
  color: #ffffff;
  margin-bottom: 2px;
}

.key-action {
  font-size: 8px;
  color: #cccccc;
  text-align: center;
  line-height: 1.2;
}

.movement-grid .key-button {
  min-width: 45px;
  min-height: 35px;
}

.altitude-grid {
  flex-direction: row;
  justify-content: space-around;
}

.altitude-grid .key-button {
  flex: 1;
  max-width: 80px;
}

.rotation-grid {
  flex-direction: row;
  justify-content: space-around;
}

.rotation-grid .key-button {
  flex: 1;
  max-width: 80px;
}

.actions-grid {
  gap: 4px;
}

.actions-grid .key-button {
  width: 100%;
  min-height: 35px;
}

.status-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.status-label {
  font-size: 9px;
  color: #cccccc;
}

.status-value {
  font-size: 9px;
  font-weight: bold;
}

.status-value.flying {
  color: #4CAF50;
}

.status-value.grounded {
  color: #ff9800;
}

.status-value.auto {
  color: #2196f3;
}

.status-value.manual {
  color: #00ff00;
}

.instructions {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 4px;
  border-left: 3px solid #00bfff;
}

.instructions ul {
  margin: 0;
  padding-left: 12px;
  color: #cccccc;
}

.instructions li {
  font-size: 9px;
  margin-bottom: 4px;
  line-height: 1.3;
}

.instructions strong {
  color: #ffffff;
}

/* Scrollbar styling */
.keyboard-controls::-webkit-scrollbar {
  width: 4px;
}

.keyboard-controls::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.keyboard-controls::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .keyboard-controls {
    position: relative;
    top: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: none;
    margin: 10px 0;
    border-radius: 0;
  }

  .key-button {
    min-width: 40px;
    min-height: 32px;
    padding: 4px 6px;
  }

  .key-label {
    font-size: 9px;
  }

  .key-action {
    font-size: 7px;
  }
}

/* Animation for active keys */
@keyframes keyPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1.05);
  }
}

.key-button.active {
  animation: keyPress 0.1s ease-out;
}
